package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum ShopDeliveryType {
	DISTANCE(0,"按一定距离配送"),TOWN(1,"同城配送"),CITY(2,"市内配送"),PROVINCE(3,"省内配送"),UNLIMITED(4,"不限配送距离");
	
	private String text;
	private Integer value;
	
	private ShopDeliveryType(Integer value, String text) {
		this.value = value;
		this.text = text;
	}
	
	public Integer toIntValue() {
		return this.value;
	}

	public String toStringText() {
		return this.text;
	}

	public static ShopDeliveryType toStatus(Integer value) {
		if (DISTANCE.value == value) {
			return DISTANCE;
		} else if (TOWN.value == value) {
			return TOWN;
		} else if (CITY.value == value) {
			return CITY;
		} else if (PROVINCE.value == value) {
			return PROVINCE;
		} else if (UNLIMITED.value == value) {
			return UNLIMITED;
		} else {
			throw new InvalidArgumentException("Unknown OrderStatus[" + value + "].");
		}
	}
}
